 <?
  $action = $this -> saved ? "Unsubscribe from {$this->group->Name}" : "Subscribe to {$this->group->Name}";
  $amount = 50000;
  $lowid  = $this->group->LowID - $amount;

  if ($lowid < $this->group->MinID)
  {
      $lowid = $this->group->MinID;
      $amount = $this->group->LowID - $lowid;
  }

  $data = array (
           
    $this->group->LowID,
    $this->group->HighID, 
    $this->group->MinID,
    $this->group->MaxID  

     );


?> 

  <ul class="my-menu">


    <li><a class="bookmark" id="/rpc/subscribe/id/<?= $this->group->Key ?>/user/<?= $this->user ?>"><?= $action ?></a></li>

<? if ($amount > 0): ?>
    <li><a>Get the previous <i>n</i> items starting at <?= $this->group->LowID ?> </a>
		   
		   
      <ul>
	       <li><a class="group-join <?= $this->group->LowID ?> 50000" id="<?= $this->group->Name ?>">50000</a></li>
	       <li><a class="group-join <?= $this->group->LowID ?> 100000" id="<?= $this->group->Name ?>">100000</a></li>
	       <li><a class="group-join <?= $this->group->LowID ?> 150000" id="<?= $this->group->Name ?>">150000</a></li>

      </ul>
 
		   
		   </li> 
<? endif ?>

<? if ($this->group->HighID < $this->group->MaxID): ?>
    <li><a class="group-join <?= $this->group->HighID + 50000 ?> 50000" id="<?= $this->group->Name ?>">Get the next 50000 items starting at <?= $this->group->HighID ?>...</a></li> 
<? endif ?>


<!--
    <li><a class="group-renew" id="<?= $this->group->Name ?>">Clear all articles and reload...</a></li> 
-->


    <li><a>Show only items with at least</a>

      <ul>

<? for ($x=0;$x<250;$x+=25): ?>
     <li 
             <?if ($x==$this->most): ?>
                 class="selected" 
             <? endif ?>
         ><a class="a-count" id="<?= $x ?>"><?= $x ?> items!</a>

         </li>
<? endfor?> 

      </ul>
 
      </li> 




    <li>
 <a class="rpcparam">Find in group... </a>
      </li> 




    <li>
 <a>Open related group </a>
      <ul>
<? while (list($name,$val) = each ($this->refs) ): ?>

       <?if (strlen($name) > 10): ?>
      <li 
         ><a id="<?= $name ?>" class="a-group"><?= $name ?></a></li>
        <?endif?>

<? endwhile ?>
      </ul>

      </li> 


<? if (sizeof($this->searches) > 0): ?> 
    <li>
        <a>Saved searches</a>

      <ul>

<? foreach ($this->searches as $search): ?>
     <li 
             <?if ($search==$this->search): ?>
                 class="selected" 
             <? endif ?>
         ><a href='<?= $this->url(array("search" => $search, "page" => 1, "most" => NULL)) ?>'><?= $search ?></a>

         </li>
<? endforeach?> 

      </ul>
 

     
   </li>

<? endif ?>

</ul>
 
   <input type="hidden" id="text-user" value="<?= $this->user ?>"/>   
 
  
 
                    <div id="div-stat"><?= $this -> pages ?></div>

                    <ul class="rounded">

		 <? foreach ($this->articles as $article):
                            $css    = $article -> cache ? "cache" : "";
                            $bk     = $article -> bookmarked ? "** " : "";
                            $count  = $article -> count;

                       $parts  = sizeof ( explode("-", $article -> id) );
                       if (preg_match('/\((\d+)\/(\d+)\)/', $article -> subject, $x))
                       {
                           $countof = $x[2];
                           $hue = $countof == $parts ? "#000" : "#900";
                       }

                            ?>
		     
			<li style="color:<?= $hue ?>" class="<?= $count ?> arrow article-<?= $article -> type ?> <?= $css?>" id="<?= $article -> uuid ?>" 
                           data-article-count="<?= $count ?>"
                           data-article-key="<?= $article -> uuid  ?>"
                           data-book-marked="<?= $bk  ?>"
                      	   data-verbose="true"
                           data-direct="/article/list/user/{0}/from/{1}/id/{2}"
			    ><?= $article->date ?>, (<?= $bk ?>)<?= $article -> subject ?><?= $parts ?>, <?= $countof ?></li> 
			
		   
		<? endforeach ?>

                    </ul> 
  
 
<div id="dialog" title="<?= $this->group->Name ?> options">

    <li> <div class="span-of" id="<?= implode ('x', $data) ?>">loading...</div></li> 


</div> 

